@echo off  
:: BatchGotAdmin  
REM  --> 检查用户权限
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"  
  
REM --> If error flag set, we do not have admin.  
if '%errorLevel%' NEQ '0' (  
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"  
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"  
    "%temp%\getadmin.vbs"  
    del "%temp%\getadmin.vbs"  
    exit /B  
)  
  
:: Your batch commands here...
cd /d %~dp0   
call var.bat
mkdir %db_path%
mkdir %db_backup_path%
for /L %%i in (%instance_start%,1,%instance_end%) do (  
	mkdir %db_path%\db%%i
	mkdir %db_backup_path%\db%%i
	echo -config %~dp0config\influxdb%%i.conf
	call function_installService.bat influx%%i influxd.exe "-config %~dp0config\influxdb%%i.conf" "influxDB-%%i#"
	sc start influx%%i
	ping 127.0.0.1 -n 1 -w 100 > nul
	influx -host localhost -port %%i -execute "CREATE DATABASE winccoa"
	influx -host localhost -port %%i -execute "CREATE USER "etm" WITH PASSWORD 'etm#123' WITH ALL PRIVILEGES"
  
) 
pause